package com.hezy.base.application;

import android.app.Application;
import android.content.res.Configuration;
import android.support.annotation.IntRange;

/**
 * 用于组件module初始化操作
 */
public abstract class IComponent {

    public static final int PRIORITY_MIN = 1;
    public static final int PRIORITY_NORMAL = 5;
    public static final int PRIORITY_MAX = 10;

    protected final Application application;

    public IComponent(Application application) {
        this.application = application;
    }

    /**
     * 返回组件的优先级
     *
     * @return int 优先级范围为[1-10]，10为最高，1为最低，默认优先级是5
     */
    @IntRange(from = 1, to = 10)
    public int getPriority() {
        return PRIORITY_NORMAL;
    }

    public abstract void onCreate();

    public void onLowMemory() {
    }

    public void onTrimMemory(int level) {
    }

    public void onConfigurationChanged(Configuration newConfig) {
    }

    public void onTerminate() {
    }
}
